﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>网站管理</title>
    <link rel="stylesheet" href="../../../assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="../../../assets/module/admin.css?v=317"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<!-- 页面加载loading -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar">
                <form class="layui-form toolbar">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">访问日期:</label>
                            <div class="layui-input-inline">
                                <input name="date" class="layui-input" placeholder="输入访问日期" id="test2"/>
                            </div>
                        </div>
                        <div class="layui-inline">&emsp;
                            <button class="layui-btn icon-btn" lay-filter="roleTbSearch" lay-submit>
                                <i class="layui-icon">&#xe615;</i>搜索
                            </button>
                        </div>
                    </div>
                </form>
            </form>
            <!-- 数据表格 -->
            <table id="roleTable" lay-filter="roleTable"></table>
        </div>
    </div>
</div>

<!-- 表格操作列 -->
<script type="text/html" id="roleTbBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">查看</a>
</script>
<!-- 表单弹窗 -->
<script type="text/html" id="roleEditDialog">
    <form id="roleEditForm" lay-filter="roleEditForm" class="layui-form model-form">
        <input name="adviceId" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">姓名:</label>
            <div class="layui-input-block">
                <input name="trueName" placeholder="请输入角色名" class="layui-input"
                       lay-verType="tips" lay-verify="required" required readonly/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">建议:</label>
            <div class="layui-input-block">
                <textarea name="advice" placeholder="请输入备注" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结果:</label>
            <div class="layui-input-block">
                <select name="status">
                    <option value="1" selected>同意</option>
                    <option value="0">不同意</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="roleEditSubmit" lay-submit>保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>
<!-- js部分 -->
<script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="../../../assets/js/common.js?v=317"></script>
<script type="text/javascript" src="../../../assets/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../../assets/js/js.cookie.min.js"></script>
<script type="text/javascript" src="../../../assets/js/sqjx.js"></script>
<script>
    layui.use(['layer', 'form', 'table', 'laydate', 'zTree'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var laydate = layui.laydate;
        laydate.render({
            elem: '#test2', //指定元素
            type: 'date',
            range: '至'
        });
        /* 渲染表格 */
        var insTb = table.render({
            elem: '#roleTable',
            url: '/office/website/queryCount',
            page: true,
            method: 'post',
            request: {
                pageName: 'page',
                limitName: 'rows',
            },
            cellMinWidth: 100,
            height: $(window).height() - 100,
            cols: [[
                {type: 'numbers'},
                {field: 'address', title: '访问地址', sort: false},
                {field: 'clickIp', title: '访问主机', sort: false},
                {
                    field: 'crtDate', title: '访问时间', sort: false, templet(row) {
                        return dateFormatter(row.crtDate)
                    }
                },
            ]],
            parseData: function (res) {
                res = res.obj;
                return {
                    "code": 0,
                    "msg": "",
                    "count": res.total,
                    "data": res.rows
                }
            }
        });

        /* 表格搜索 */
        form.on('submit(roleTbSearch)', function (data) {
            var field = data.field.date.split("至");
            var param = {
                startTime: field[0],
                endTime: field[1]
            }
            insTb.reload({where: param, page: {curr: 1}});
            return false;
        });
    });
</script>
</body>
</html>